import { AfterViewInit, Component, EventEmitter, Input, Output } from '@angular/core';
import { MapServerService } from '../map-server/map-server.service';

@Component({
  selector: 'app-map-component',
  templateUrl: './map-component.component.html',
  styleUrls: ['./map-component.component.scss']
})
export class MapComponentComponent implements AfterViewInit {

  @Input() point: any;

  constructor(private mapServerService: MapServerService) { }

  ngAfterViewInit(): void {
    this.initMap()
  }
  
  public initMap(): void {
    const map = new google.maps.Map(
      document.getElementById("map") as HTMLElement,
      {
        zoom: 8,
        center: this.point,
      }
    );
    this.mapServerService.setMapObj(map);
  }

}
